#ifndef _GLOBAL_H
#define _GLOBAL_H
#include "gb.h"
#include "MkMemQueue.h"
#include "MkThread.h"

#if(defined(WIN32))
#define  snprintf _snprintf
#pragma comment(lib,"Dnsapi")
#pragma comment(lib,"WS2_32")
#pragma comment(lib,"Iphlpapi")
#endif

#ifndef FALSE
#define FALSE               0
#endif

#ifndef TRUE
#define TRUE                1
#endif
//#endif

extern bool                 g_sip_init;
extern CMkThread            g_udp_event_thread[2];
extern Uint32               g_udp_event_flag;
extern CMkThread            g_tcp_event_thread[2];
extern Uint32               g_tcp_event_flag;
extern char *               g_siphost;
extern char *               g_sipid;
extern char *               g_realm;
extern Uint32               g_sipport;
extern Uint32               g_wait_time;
extern fexception_callback  g_excep_cb;
extern void *               g_excep_user;
extern Uint8                g_authorizate;

extern std::vector<mk_gb_server_param_t> g_gb_server_list;

Uint32 add_client(const char* host, Uint16 port, const char* sip_id, const char* user_name, const char* password,
    Uint32 expries, Uint32& UserId);

Uint32 get_message_sn();

void mk_gbtime_to_sdktime(const char *gbtime, lpnet_time sdktime);

void mk_sdktime_to_gbtime(const lpnet_time sdktime, char *gbtime);

void mk_gbtime_to_systime(const lpnet_time sdktime, char *gbtime);

void mk_sdktime_to_systemtime(const char *stime, struct tm *st);

void mk_sdktime_to_utctime(const lpnet_time sdktime, time_t& utctime);

#endif